<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN">
<head>
<title>登录...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="images/favicon.ico">
<link rel="stylesheet" type="text/css" href="easyui/themes/bootstrap/easyui.css" />
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="css/common.css" />
<script type="text/javascript" src="easyui/jquery.min.js"></script>
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">


	/*这个页面没用了*/
	
	
	var regDialog;
	var regForm;
	$(function() {
		//ajax 提交
		regDialog = $('#regDialog').dialog({
			modal : true,
			closable : false,
			iconCls : 'icon-tip',
			buttons : [ {
				text : '提交',
				iconCls : 'icon-ok',
				handler : function() {
					regForm.submit();
				}
			}, {
				text : '重置',
				iconCls : 'icon-clean',
				handler : function() {
					regForm.clean();
					//console.info('dianjidenglu');
					/*
					if($('#regForm').form('validate')){
					$.ajax({
						url : 'login.do?',
						data : $('#regForm').serialize(),//序列化表格为字符串 username=a?password=b
						/*复杂写法
						data : {
						username : $('#regForm input[name=username]').val(),
						password : $('#regForm input[name=password]').val()
						},*/
					/*cache : false,
					dataType : 'json',
					success : function(r) {
						//console.info(r.msg);
						if (r && r.success) {
							regDialog.dialog('close');
							$.messager.show({
								title : '提示',
								msg : '登录成功',
								showType : 'show'
							});
						} else {
							$.messager.alert('提示', '用户名密码错误');
						}
					},
					error : function() {
						$.messager.alert('提示', '用户名密码错误');
					}
					});}*/
				}
			} ]
		});
		//form 提交
		regForm = $('#regForm').form({
			url : '${pageContext.request.contextPath}/reg.do?',
			success : function(r) {
				//r = eval("(" + r + ")");
				$.parseJSON(r);//将标准json转成obj
				if (r && r.success) {
					regDialog.dialog('close');
					$.messager.show({
						title : '提示',
						msg : '登录成功',
						showType : 'show'
					});
				} else {
					$.messager.alert('提示', '用户名密码错误');
				}
			},
			error : function() {
				$.messager.alert('提示', '用户名密码错误');
			}
		});
		//回车换行和提交
		regForm.find('input').on('keyup', function(event) {
			if (event.keyCode == '13') {
				regForm.submit();
			}
		});

	});
</script>
</head>
<body>
	<div id="regDialog" title="用户登录" style="width: 300px; height: 200px; padding: 22px">
		<form id="regForm" action="" method="post">
			<table>
				<tr>
					<th>用户名</th>
					<td><input class="easyui-validatebox" name="username" type="text" value=""
						data-options="required:true,missingMessage:'请输入用户名'" /></td>
				</tr>
				<tr>
					<th>密码</th>
					<td><input class="easyui-validatebox" name="password" type="password" value="" data-options="required:true" /></td>
				</tr>
				<tr>
					<th>确认密码</th>
					<td><input class="easyui-validatebox" name="repassword" type="password" value=""
						data-options="required:true,validType:eqPwd[\'#regForm input[name=password]\'" /></td>
				</tr>
				<tr>
					<th>用户类型</th>
					<td><select class="easyui-combobox" name="role" style="width: 173px" panelHeight="62px">
							<option value="admin">管理员</option>
							<option value="student">学生</option>
							<option value="teacher">老师</option>
					</select></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>